package restful.struts2;

import org.apache.struts2.config.*;

import restful.*;
import restful.servlet.*;

import com.opensymphony.xwork2.inject.*;

public class RestfulPackageProvider extends ClasspathPackageProvider {

	private RestfulScanner scanner;

	private String classSuffix;

	@Override
	protected void processActionClass(Class<?> restfulClass, String[] packages) {
		scanner.scanning(classSuffix, restfulClass);
	}

	@Inject("restfulProtocol")
	public void setRestfulProtocol(RestfulProtocol restfulProtocol) {
		scanner = new RestfulScanner(restfulProtocol);
	}

	@Inject("struts.codebehind.classSuffix")
	public void setSuffix(String classSuffix) {
		this.classSuffix = classSuffix;
	}
}